{
    title:  "Building Executables",
    crumbs: [
        { "Developer's Guide": 'index.html' },
    ],
}

        <h2>Executables</h2>
        <p>MakeMe creates executables by specifying the required source files and libraries in an exe target. For example:
<pre class="ui code segment">
bingo: {
    type: 'exe',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame'],
},
</pre>
        <p>This will compile and link the bingo.c source and save an executable called <em>bingo</em> or
        <em>bingo.exe</em> for windows in the current directory.</p>
        <p>You can modify the output filename by defining a <em>path</em> property. For example:</p>
<pre class="ui code segment">
bingo: {
    type: 'exe',
    path: 'output/bingo',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame'],
},
</pre>
        <p>Without a path property, MakeMe computes one from the name of the property target.</p>

        <a name="dependencies"></a>
        <h2>Dependencies</h2>
        <p>Dependent libraries are specified via the <em>depends</em> property. This property takes a list of other targets
        that must be built before the current target can complete. Note: that these are the target names (target.name
        property) and not the library name. To specify external libraries that are not built with MakeMe, use the
        <em>libraries</em> property collection.</p>
<pre class="ui code segment">
rocket: {
    type: 'exe',
    sources: [ '*.c' ],
    headers: [ '*.h' ],
    depends: [ 'fuel' ],
    libraries: [ 'pam' ],
},
</pre>
        <h2>Configurable Components</h2>
        <p>Products are sometimes configured with components that provide libraries to augment the product. For
        example: the PHP component adds the libphp library. To cause a target to be built only if the component is available,
        use the <em>ifdef</em> property. For example:</p>
<pre class="ui code segment">
rocket: {
    type: 'exe',
    sources: [ '*.c' ],
    headers: [ '*.h' ],
    depends: [ 'fuel', 'booster' ],
    <b>ifdef: [ 'booster' ]</b>,
</pre>
        <p>Note that <em>ifdef</em> does not import add any component defined libraries, library paths, include paths or
        compiler definitions to this target. To do that, use the <em>depends</em> property or the <em>uses</em>
        property for optional components.</p> 
        
        <p>To do a static link of the executable, set the <i>static</i> property to true.  This will link the executable
        directly with all the required objects. MakeMe will expand the list of dependant libraries and explicitly link with all
        their constituent objects.</p>
<pre class="ui code segment">
bingo: {
    type: 'exe',
    sources: [ 'bingo.c' ],
    depends: [ 'libgame' ],
    static: true,
},
</pre>
        <p>To learn more, read about <a href="scripts.html">Running Scripts</a>.</p>
